package com.company.management.controller.reward;

import com.company.management.domain.reward.dto.RewardsQueryDTO;
import com.company.management.domain.reward.vo.RewardsQueryVO;
import com.company.management.domain.reward.dto.RewardsAddDTO;
import com.company.management.service.reward.RewardsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;


import java.util.Date;
import java.util.List;

/**
 * @description:奖励
 * @author: wangbin
 * @time: 2025/3/1
 **/
@Api(tags = "奖惩模块", value = "职位 RewardsController")
@RestController
@RequestMapping("/api/rewards")
public class RewardsController {
    @Autowired
    private RewardsService rewardsService;

    /**
     * @param rewardsAddDTO 新增奖励参数对象
     * @return
     * @Description: 新增奖励
     * @Author: wangbin
     * @Date: 2025/3/1 15:07
     **/
    @PostMapping("/createRewards")
    public ResponseEntity<Boolean> add(@RequestBody RewardsAddDTO rewardsAddDTO) {
        rewardsService.add(rewardsAddDTO);
        return new ResponseEntity<>(HttpStatus.OK);
    }
    /**
     * @param rewardId 奖励ID
     * @return
     * @Description: 查看奖励
     * @Author: wangbin
     * @Date: 2025/3/1 15:10
     **/
    @GetMapping("/gerRewards")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "rewardId", value = "奖励ID", required = false, dataType = "string", paramType = "query")
    })
    public ResponseEntity<RewardsQueryVO> gerRewards(@RequestParam(value = "rewardId") Integer rewardId) {
        return new ResponseEntity<>(rewardsService.findByRewardId(rewardId), HttpStatus.OK);
    }

    /**
     * @return
     * @Description: 查看奖励列表
     * @Author: wangbin
     * @Date: 2025/3/1 15:10
     **/
    @PostMapping("/gerRewardsList")
    public ResponseEntity<List<RewardsQueryVO>> gerRewardsList(@RequestBody RewardsQueryDTO rewardsQueryDTO) {
        return new ResponseEntity<>(rewardsService.findByUserId(rewardsQueryDTO), HttpStatus.OK);
    }

}
